package com.infomanage.enums;

import java.util.HashMap;
import java.util.Map;

//行政级别
public enum AdministrationDegreeType {
	TJZ(1, "厅级正职"), TJF(2, "厅级副职"), CJZ(3, "处级正职"), CJF(4, "处级副职"), KJZ(5,
			"科级正职"), KJF(6, "科级副职"), KY(7, "科员"), BSY(8, "办事员"),NONE(19, "无");

	private int value;
	private String title;

	AdministrationDegreeType(int value, String title) {
		this.value = value;
		this.title = title;
	}

	/**
	 * 获取枚举值
	 * @return 返回枚举值
	 */
	public int value() {
		return this.value;
	}

	/**
	 * 获取枚举标题
	 * @return 返回枚举的标题
	 */
	public String title() {
		return this.title;
	}

	private static Map<String, AdministrationDegreeType> titlefinder;
	static {
		titlefinder = new HashMap<String, AdministrationDegreeType>();
		for (AdministrationDegreeType item : AdministrationDegreeType.values())
			titlefinder.put(item.title(), item);

	}

	private static Map<Integer, AdministrationDegreeType> valuefinder;
	static {
		valuefinder = new HashMap<Integer, AdministrationDegreeType>();
		for (AdministrationDegreeType item : AdministrationDegreeType.values())
			valuefinder.put(new Integer(item.value()), item);

	}

	/**
	 * 按照枚举值查找枚举
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static AdministrationDegreeType valueOf(int type) {
		return valuefinder.get(new Integer(type));
	}

	/**
	 * 按照枚举标题查找枚举值
	 * 
	 * @param value
	 *            数据类型值对象
	 * @return 返回枚举值对象
	 */
	public static AdministrationDegreeType titleOf(String title) {
		return titlefinder.get(title);
	}
	
	public static AdministrationDegreeType[] getMembers() {
		return new AdministrationDegreeType[] {TJZ, TJF, CJZ, CJF, KJZ, KJF, KY, BSY,NONE};
	}
}
